<template>
	<el-menu
		:default-active="$route.path"
		id="huxy-menu"
		:collapse-transition="false"
		:collapse="collapse"
		background-color="#333744"
		text-color="#fff"
		active-text-color="#409eff"
		router
	>
		<template v-for="(item, index) in menu">
			<el-submenu v-if="item.childen" :index="item.text">
				<template slot="title">
					<i :class="item.icon"></i>
					<span>{{ item.text }}</span>
				</template>
				<el-menu-item v-for="(c, ind) in item.childen" :index="c.path" :key="'submenu-' + ind">
					<i :class="c.icon"></i>
					<span>{{ c.text }}</span>
				</el-menu-item>
			</el-submenu>
			<el-menu-item v-else :index="item.path">
				<i :class="item.icon"></i>
				<span>{{ item.text }}</span>
			</el-menu-item>
		</template>
	</el-menu>
</template>

<script>
export default {
	computed: {
		collapse() {
			return this.$store.state.collapse;
		}
	},
	methods: {
		handleOpen(key, keyPath) {
			console.log(key, keyPath);
		},
		handleClose(key, keyPath) {
			console.log(key, keyPath);
		}
	},
	data() {
		return {
			menu: [
				{
					path: '/dashboard',
					icon: 'el-icon-pie-chart',
					text: '仪表盘'
				},
				{
					icon: 'el-icon-document',
					text: '日志管理',
					childen: [
						{
							icon: 'el-icon-data-analysis',
							text: '访问日志',
							path: '/log/visitorLog'
						},
						{
							icon: 'el-icon-document-delete',
							text: '异常日志',
							path: '/log/exceptionLog'
						},
						// {
						// 	icon: 'el-icon-thumb',
						// 	text: '操作日志',
						// 	path: '/log/operationLog'
						// },
						// {
						// 	icon: 'el-icon-time',
						// 	text: '任务日志',
						// 	path: '/log/scheduleLog'
						// }
					]
				},
				{
					icon: 'el-icon-c-scale-to-original',
					text: '其他设置',
					childen: [
						{
							path: '/other/videoApi',
							icon: 'el-icon-video-camera-solid',
							text: '视频解析'
						},
						// {
						// 	path: '/other/nav',
						// 	icon: 'el-icon-s-promotion',
						// 	text: '网址导航'
						// },
						// {
						// 	path: '/other/backgroundImage',
						// 	icon: 'el-icon-picture-outline-round',
						// 	text: '背景图片'
						// }
					]
				},
				{
					icon: 'el-icon-setting',
					text: '系统设置',
					childen: [
						// {
						// 	path: '/setting/timer',
						// 	icon: 'el-icon-alarm-clock',
						// 	text: '定时任务'
						// },
						{
							path: '/setting/cache',
							icon: 'el-icon-coin',
							text: '缓存管理'
						},
						// {
						// 	path: '/setting/updateSystem',
						// 	icon: 'el-icon-upload',
						// 	text: '更新系统'
						// },
						// {
						// 	path: '/setting/updateCMS',
						// 	icon: 'el-icon-sort',
						// 	text: '更新CMS'
						// },
						// {
						// 	path: '/setting/updateVIEW',
						// 	icon: 'el-icon-top',
						// 	text: '更新VIEW'
						// }
					]
				},
				{
					text: '图片管理',
					icon: 'el-icon-s-tools',
					childen: [
						{
							text: '图片转换',
							icon: 'el-icon-picture-outline',
							path: '/image/imgConvert'
						},{
							text: '图片定位',
							icon: 'el-icon-location-information',
							path: '/image/location'
						}
					]
				},
				{
					path: '/userinfo',
					icon: 'el-icon-user-solid',
					text: '用户设置'
				}
			]
		};
	}
};
</script>

<style lang="scss">
#huxy-menu {
	height: 100%;
	border: none;
	* {
		user-select: none;
	}
}
</style>
